<?php 

if($_SESSION['active'] != 'active' )
{


?>
<table class="form-signin" align="right">
<form action="chklogin.php" name="sublogin" id="sublogin">
 <input type="hidden" name="chklogin" id="chklogin" value="chklogin">
  <tr>
    <td ><input type="text" name="username" id="username"  class="form-login" placeholder="Email address" value =""/></td>
    <td ><input type="password" name="password" id="password" class="form-login" value =""  placeholder="Password" /></td>
    <td ><button class="btn btn-vsmall" type="button" onclick="logincheck()">Sign in</button>
	<div id="error"></div>
	</td>
  </tr>
  <tr>
    <td><label class="checkbox">
						<input type="checkbox" value="remember-me" /> Remember me
					</label></td>
    <td colspan="2"><a href="forgotten-password.html">Forgotten password?</a></td>
    
  </tr>
</form>
</table>	

<?php 
} else {
	
?>


	<div align="right">
    <br />
		Welcome <img src="img/icon/glyphicons_024_parents.png" height="15" /><?php echo $_SESSION['user'];?>
	</div>



<?php }?>

<script>


function logincheck()
{

	if($("#username").val() == '' || $("#password").val() == '' )
	{	
		$("#error").html("กรุณากรอกข้อมูลให้ครบ");
	}else{
		$("#sublogin").submit();
	}
}

</script>